<?php
/**
 * @ClassName: UserStatus
 * @Description: 用户状态枚举
 * @author: wyaohu
 * @Date: 2024/9/8 19:51
 * @Version: V1.0.0
 */

namespace app\common\enum;

class UserStatus
{
    const CANCAL = -1;
    const DISABLE = 0;
    const NORMAL = 1;
    const LOCK = 2;

    /**
     * 用户状态 -1注销 0禁用 1正常 2锁定
     * @param $level
     * @return string|string[]
     */
    public static function text($level)
    {
        $desc = [
            UserStatus::CANCAL => '注销',
            UserStatus::DISABLE => '禁用',
            UserStatus::NORMAL => '正常',
            UserStatus::LOCK => '锁定',
        ];
        if ($level === true) {
            return $desc;
        }
        return $desc[$level] ?? $level;
    }

}